<?php

namespace Library\Widget;

class Options extends \Library\Widget {

	private $_groups = array();
	
	public function __construct() {
		parent::__construct();
		$this->getGroup( 'user' )
			->setTitle( 'Account' )
			->getOption( 'preferences' )
				->setTitle( 'Preferences' )
				->setAction( 'user_preferences' )
				->getGroup()
			->getOption( 'logout' )
				->setTitle( 'Logout' )
				->setHref( './Logout' );
		$this->getGroup( 'tools' )
			->setTitle( 'Tools' )
			->getOption( 'abuse' )
				->setTitle( 'Report abuse' )
				->setAction( 'report_abuse' );
	}

	public function getGroup( $key ) {
		if( !isset( $this->_groups[ $key ]) ) {
			$this->_groups[ $key ] = new Options\Group( $key, $this );
		}
		return $this->_groups[ $key ];
	}
	
	public function getGroups() {
		return $this->_groups;
	}
}

